/*************************************************************************
	> File Name: P2758.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-04-02 09:26:34
 ************************************************************************/
#include <iostream>
#include <vector>
using namespace std;

int get_min(string &a, string &b) {
    vector<vector<int> > dp(a.size() + 1, vector<int>(b.size() + 1));
    for (int i = 0; i <= a.size(); i++) 
        dp[i][0] = i;
    for (int j = 0; j <= b.size(); j++) 
        dp[0][j] = j;
    for (int i = 1; i <= a.size(); i++) {
        for (int j = 1; j <= b.size(); j++) {
            if (a[i - 1] == b[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1];
            } else {
                dp[i][j] = min(dp[i - 1][j] + 1, dp[i][j - 1] + 1);
                dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + 1);
            }
        }
    }
    return dp[a.size()][b.size()];
}

int main() {
    string a, b;
    cin >> a >> b;
    cout << get_min(a, b) << endl;
    return 0;
}
